package com.golddaymicromall.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.golddaymicromall.activity.R;
import com.golddaymicromall.bean.BankInfoshow;
import com.golddaymicromall.util.DateFormatUtils;

import java.util.List;

/**
 * Created by dawd on 2016/3/15.
 */
public class BankInfoAdapter extends BaseAdapter {
    private List<BankInfoshow> list;
    private Context ctx;
    LayoutInflater layoutinflater;
    DateFormatUtils dateFormatUtils;

    public BankInfoAdapter(List<BankInfoshow> list, Context ctx) {
        this.list = list;
        this.ctx = ctx;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return getItem(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final  ViewHolder hold;
        View view = convertView;
        if(view == null){
            hold = new ViewHolder();
            layoutinflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = layoutinflater.inflate(R.layout.item_activity_cart_mybank, null);
            hold.mbank_number = (TextView) view.findViewById(R.id.bank_number);
            hold.mbank_name = (TextView) view.findViewById(R.id.bank_name);

        }else{
            hold = (ViewHolder) view.getTag();
        }
        hold.mbank_number.setText("卡号："+list.get(position).getBankNo());
        hold.mbank_name.setText("银行："+list.get(position).getName());
//        hold.mOnline_StoreName.setText("("+list.get(position).getUsername()+")");
//        hold.mOnline_Date.setText(new DateFormatUtils().dateFormat(list.get(position).getCreatedate().toString()));
//        hold.mOnline_Money.setText(list.get(position).getAmount().toString());
//        hold.mOnline_Status.setText(list.get(position).getSucc());
//        hold.mOnline_CardType.setText(list.get(position).getRmb());
        return view;
    }

    private class ViewHolder{
        TextView mbank_number;
        TextView mbank_name;
        TextView mOnline_StoreName;
        TextView mOnline_Date;
        TextView mOnline_Status;
        TextView mOnline_Money;
        TextView mOnline_CardType;
    }
}
